<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
</html>
<script !src="">
    var student={"son":1,"sname":"猪猪侠","age":23}
    var student1={"son":2,"sname":"奥龙","age":23}
    var student2={"son":3,"sname":"奥利给","age":23}
    var sclass=[student,student1]
    sclass.push(student2)
    for (let i in sclass){
        console.log(sclass[i].son+"---------"+sclass[i].sname+"-------"+sclass[i].age)
    }
console.log("JSON转换String前学生表类型",typeof (sclass))
    var str = JSON.stringify(sclass)
    console.log("SON转换String前后学生表类型",typeof (str))
    var goods = '[{"gid":1,"gname":"红牛","price":5.00},{"gid":2,"gname":"AD钙奶","price":7.00}]'
    console.log(typeof (goods))
    var jons = JSON.parse(goods)
    console.log(typeof (jons))
    for (let i = 0; i <jons.length ; i++) {
        console.log(jons[i].gid+"-----"+jons[i].gname+"-----"+jons[i].price)
    }

</script>